﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Practices.Prism.Logging;

namespace SLIP.Utilities
{
    public class SLIPLogger : ILoggerFacade
    {
        #region ILoggerFacade Members
        /// <summary>     
        /// Logs an entry using the Enterprise Library logging.      
        /// For logging a Category.Exception type, it is preferred to use     
        /// the EnterpriseLibraryLoggerAdapter.Exception methods."     
        /// </summary>     
        public void Log(string message, Category category, Priority priority)
        {
            WriteToLog(category, priority, message);
        }
        #endregion
        /*
        /// <summary>     
        /// Logs an entry using the Enterprise Library Logging.     
        /// </summary>     
        /// <param name="entry">the LogEntry object used to log the      
        /// entry with Enterprise Library.</param>     
        public void Log( LogEntry entry )     
        {         
            Logger.Write( entry );     
        }      
        
        // Other methods if needed, i.e., a default Exception logger.     
        public void Exception ( Exception ex ) { // do stuff } } 
        */

        /// <summary>
        /// This method is a simple Message dialog.  Need to attach more robust logging interface like CLOG
        /// </summary>
        /// <param name="pCategory"></param>
        /// <param name="pPriority"></param>
        /// <param name="pMsg"></param>
        public void WriteToLog(Category pCategory, Priority pPriority, string pMsg)
        {
            //For now, only show if it's an exception or info

            if (pCategory.Equals(Category.Exception))
            {
                MessageBox.Show(pMsg, pCategory.ToString(), MessageBoxButton.OK);
            }
            else if (pCategory.Equals(Category.Info))
            {
                //commented for now
                //MessageBox.Show(pMsg, pCategory.ToString(), MessageBoxButton.OK);
            }

            /*
            switch (pCategory)
            {
                case Category.Debug:
                    m_Logger.Debug(message);
                    break;
                case Category.Warn:
                    m_Logger.Warn(message);
                    break;
                case Category.Exception:
                    m_Logger.Error(message);
                    break;
                case Category.Info:
                    m_Logger.Info(message);
                    break;
            }
            */

        }


    }
}
